//
//  JinRiMagazineCell.m
//  JianChaRiBao
//
//  Created by 常兴宇 on 13-11-7.
//  Copyright (c) 2013年 wzyk. All rights reserved.
//

#import "JinRiMagazineCell.h"
#import "UIImageView+WebCache.h"
@interface JinRiMagazineCell()
{
    UIImageView *coverImageView;
    UILabel * coverLabel;
}
@end

@implementation JinRiMagazineCell

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        coverImageView = [[[UIImageView alloc] initWithFrame:self.bounds] autorelease];
        coverImageView.layer.shadowColor = [UIColor blackColor].CGColor;
        coverImageView.layer.shadowOpacity = 0.45;
        coverImageView.layer.shadowOffset = CGSizeMake(0, 6);
        coverImageView.layer.shadowPath = [UIBezierPath bezierPathWithRect:coverImageView.bounds].CGPath;
        coverImageView.layer.masksToBounds = NO;
        [self.contentView addSubview:coverImageView];
        
        coverLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.bounds.size.height - 35, self.bounds.size.width, 35)];
        coverLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3f];
        coverLabel.font = [UIFont systemFontOfSize:13.0f];
        coverLabel.textColor = [UIColor whiteColor];
        coverLabel.lineBreakMode = NSLineBreakByCharWrapping;
        coverLabel.numberOfLines = 0;
        [self.contentView addSubview:coverLabel];
        
        self.selectionStyle = AQGridViewCellSelectionStyleNone;
    }
    return self;
}

- (void)updateDisplayWithImageStr:(NSString *)str
{
    NSString *coverURLStr = [[_jinRiMagazineInfo objectForKey:str] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    [coverImageView setImageWithURL:[NSURL URLWithString:coverURLStr] placeholderImage:[UIImage imageNamed:@"default_image"]];
    
    coverLabel.text = [_jinRiMagazineInfo objectForKey:@"sourcenum"];

}

- (void)dealloc
{
    [_jinRiMagazineInfo release];
    [super dealloc];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
